{% extends "school/layout.html" %}

{% set page_title = translate('学生成绩查询') %}

{% block content %}
<div class="m-scontent">
<div class="m-fixed-table-top">
    <div class="title">
		<div class="name">{{translate('学生姓名')}}：{{ student.name }}
            <a class="modified" href="{{ url_for('school.edit_student', sid=student.id) }}">学生信息</a>
        </div>
        <p class="text">
			<span>{{translate('任课教师')}}：{{ music_class.teacher.name }}</span>
			<span>{{translate('所在班级')}}：{{ music_class.name }}</span>
            {% if data %}
			<span>{{translate('进度：我的旅途')}}－{{ data[0].number }}.{{ data[0].lesson }}</span>
            {% endif %}
        </p>
    </div>
</div>
<div class="m-table-top" style="top:190px;">
    <span class="sum-score">{{translate('总分')}}</span>
    <span class="study-time">{{translate('学习时间')}}</span>
    <span class="kala">{{translate('卡拉PK')}}</span>
    <span class="qupu">{{translate('曲谱PK')}}</span>
    <span class="nolight">{{translate('无灯PK')}}</span>
    <span class="act">{{translate('演奏')}}</span>
    <span class="theory">{{translate('乐理')}}</span>
    <span class="listen">{{translate('听力')}}</span>
    
</div>
<ul class="table-record table table-responsive" style="margin:152px 0 30px;">
    {% for d in data %}
        <li>
            <span class="sum-score col" style="text-align:center;"><span class="{{ d.remark_class }}">{{ d.remark }}</span></span>
            <span class="study-time col" style="line-height:1.1;">
                <div class="date">
					{{ d.time }}
                </div>
                <div class="name" id="{{ d.lesson_id }}">{{ d.lesson }}</div>
            </span>
            <span id="{{ d.pk_kara.activity_id }}" class="col kala {% if d.pk_kara.score == "" %}notgoing">{{translate('{{translate('未进行')}}')}}{% else %}">{{ d.pk_kara.score}}{% endif %}</span>
            <span id="{{ d.pk_score.activity_id }}" class="col qupu {% if d.pk_score.score == "" %}notgoing">{{translate('未进行')}}{% else %}">{{ d.pk_score.score}}{% if d.pk_score.exist_pic %}<i class="iconfont icon-file"></i>{% endif %}{% endif %}</span>
            <span id="{{ d.pk_no_led.activity_id }}" class="col nolight {% if d.pk_no_led.score == "" %}notgoing">{{translate('未进行')}}{% else %}">{{ d.pk_no_led.score}}{% if d.pk_no_led.exist_pic %}<i class="iconfont icon-file"></i>{% endif %}{% endif %}</span>
            <span id="{{ d.test_play.activity_id }}" class="col act {% if d.test_play.score == '' %}notgoing">{{translate('未进行')}}{% else %}">{{ d.test_play.score }}{% if d.test_play.exist_pic %}<i class="iconfont icon-file"></i>{% endif %}{% endif %}</span>
            <span id="{{ d.test_music_theory.activity_id }}" class="col theory {% if d.test_music_theory.score == "" %}notgoing">{{translate('未进行')}}{% else %}">{{ d.test_music_theory.score}}{% endif %}</span>
            <span id="{{ d.test_listen.activity_id }}" class="col listen {% if d.test_listen.score == ''%}notgoing">{{translate('未进行')}}{% else %}">{{ d.test_listen.score}}{% endif %}</span>
            
        </li>
        {% endfor %}
</ul>
</div>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog  modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="modalTitle">{{translate('成绩单')}}</h4>
      </div>
      <div class="modal-body">

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">{{translate('关闭')}}</button>
      </div>
    </div>
  </div>
</div>

{% endblock %}

{% block js_assets %}
{{ super() }}
<script type="text/javascript">
	$('.icon-file').bind('click',function(){
		var activity_id = $(this).parent().attr('id');
		var url = '/school/record/images/' + activity_id;
		$.get(url, function(data){
			if (data['code']!=0){
				alert(data['msg']);
				return;
            }else{
                var htmlStr = '';
                var imagePaths = data['data']['images'];
                for (var i in imagePaths){
                    htmlStr += '<img width="800px" src="' + imagePaths[i] + '" />';
                }
                $('#myModal .modal-body').html(htmlStr);
                $('#myModal').modal('show');
                $('.modal-body>img').width('800px');
            }

		}, 'json');
	});
</script>
{% endblock %}
